package edu.csl.study.shardingsphere.health.controller;


import edu.csl.study.shardingsphere.health.entity.EncryptUser;
import edu.csl.study.shardingsphere.health.service.IEncryptUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 自动生成代码
 * @since 2022-05-21
 */
@RestController
@RequestMapping("/health/encrypt-user")
public class EncryptUserController {
  @Autowired
  IEncryptUserService encryptUserService;

    @RequestMapping("/list")
    public List<EncryptUser> getUsers() throws SQLException {

        return encryptUserService.getEncryptUsers();
    }
    @RequestMapping("/insert")
    public String processUsers() throws SQLException {
        encryptUserService.processEncryptUsers();
        return "insert SUCCESS";
    }

    @RequestMapping("/delete")
    public String deleteList() throws SQLException {
        encryptUserService.deleteAll();
        return "delete SUCCESS";
    }

}
